@{layout('')}

<!DOCTYPE html>
<html>
<head>
    <title>Download progress</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=10" />
    <meta name="format-detection" content="telephone=no"/>
    <meta name="viewport" content="width=1024, user-scalable=yes" />
    <meta name="robots" content="all,follow" />
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <style type="text/css">
        body { padding: 50px; margin: 0; font:normal 12px Arial; color: gray }
        #progress { text-align:center; font-size: 100px; font-weight: bold; color: black; }
        a { text-align: center; text-decoration: none; display: block; color: gray; width: 200px; padding: 3px 10px; border-radius: 4px; margin: 15px auto; background-color: #F0F0F0; }
        a:hover { background-color: #E0E0E0; }
    </style>
</head>
<body>

    <div id="progress">0%</div>
    <div><a href="/download/">Download larger file</a></div>

    <script type="text/javascript">
        setInterval(function() {
            $.get('/?ts=' + new Date().getTime(), function(data) {
                $('#progress').html(data.percentage + '%');
            });
        }, 1000);
    </script>

</body>
</html>